<%-- 
    Document   : adminTmpl
    Created on : Feb 18, 2014, 12:49:26 PM
    Author     : Marek
--%>
<%@page import="entities.users.FormSigner"%>
<%@page import="entities.tools.Form"%>
<%@page import="entities.tools.FilledForm"%>
<%@page import="entities.tools.Answer"%>
<%@page import="util.other.ENUMQuestionTypes"%>
<%@page import="entities.tools.Question"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %> 
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<c:if test="${not empty param.page}" >
    <c:set var="getParamPage" value="${param.page}" scope="session"/>
</c:if>
<c:if test="${not empty param.generate}" >
    <c:set var="getParamGenerate" value="${param.generate}" scope="session"/>
</c:if>
<c:if test="${empty param.generate}" >
    <c:remove var="getParamGenerate" scope="session"/>
</c:if>
<c:if test="${not empty param.delete}" >
    <c:set var="getParamDelete" value="${param.delete}" scope="session"/>
</c:if>
<c:if test="${empty param.delete}" >
    <c:remove var="getParamDelete" scope="session"/>
</c:if>
<c:if test="${not empty param.select}" >
    <c:set var="getParamSelect" value="${param.select}" scope="session"/>
</c:if>
<c:if test="${empty param.select}" >
    <c:remove var="getParamSelect" scope="session"/>
</c:if>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Admin panel</title>
    </head>
    <body class="body">
        <div class="adminMenu">
            <a href="<c:url value="?page=link.jsp"/>">/ Links</a>
            <a href="<c:url value="?page=raport.jsp"/>">/ Raport</a>
            <a href="<c:url value="?page=forms.jsp"/>">/ Forms</a>
            <a href="<c:url value="?page=formSigners.jsp"/>">/ Forms Signers</a>
            <a href="<c:url value="?page=formOwners.jsp"/>">/ Forms Owners</a>
            <a href="<c:url value="?page=adminUsers.jsp"/>">/ Admin users</a>
        </div>
        <div class="adminMain">
            <c:choose>
                <c:when test="${not empty sessionScope.getParamPage and '' ne sessionScope.getParamPage}" >
                    <c:set var="url" value="${sessionScope.getParamPage}"/>
                    <jsp:include page="${url}"/>
                </c:when>
                <c:otherwise>

                    Choose one option from the upper menu.
                </c:otherwise>
            </c:choose>

            <%
                /*
                  If any included servlet sent redirectTo request, this redirect is saved in 'redirectTo' session atribute
                  Following code do this requested redirect
                */
                String site = (String)session.getAttribute("JSPREDIRECTTO");
                response.setStatus(response.SC_MOVED_TEMPORARILY);
                response.setHeader("Location", site);
                session.removeAttribute("JSPREDIRECTTO");
            %>
            
        </div>
    </body>
</html>

